<?php
//echo $cantmd;
$container_bl=join('&nbsp;', $form->_button_container['BL']);
$container_br=join('&nbsp;', $form->_button_container['BR']);
$container_tr=join('&nbsp;', $form->_button_container['TR']);

$campos=$form->template_details('itpprot');
$scampos  ='<tr id="tr_itpprot_<#i#>">';
$scampos .='<td class="littletablerow" align="left" >'.$campos['docu']['field'].'</td>';
$scampos .='<td class="littletablerow" align="left" >'.$campos['cuenta']['field'].'</td>';
$scampos .='<td class="littletablerow" align="left" >'.$campos['desca']['field'].'</td>';
$scampos .='<td class="littletablerow" align="left" >'.$campos['ruc']['field'].'</td>';
$scampos .='<td class="littletablerow" align="left" >'.$campos['tipo']['field'].'</td>';
$scampos .='<td class="littletablerow" align="right">'.$campos['importe']['field'].'</td>';
$scampos .='<td class="littletablerow" align="right">'.$campos['creditos']['field'];

$scampos .= '<td class="littletablerow"><a href=# onclick="del_itpprot(<#i#>);return false;">'.img("images/delete.jpg").'</a></td></tr>';
$campos=$form->js_escape($scampos);

if ($form->_status=='delete' || $form->_action=='delete' || $form->_status=='unknow_record'):
	echo $form->output;
else:

if(isset($form->error_string)) echo '<div class="alert">'.$form->error_string.'</div>';
echo $form_scripts;
echo $form_begin;

$link=base_url()."common/numegreso";
$link2=base_url()."common/moneda";
$link3=base_url()."common/cfecha";
if($form->_status!='show'){ ?>

<script language="javascript" type="text/javascript">
var itpprot_cont=<?php echo $form->max_rel_count['itpprot']; ?>;

$(function(){
	$(".inputnum").numeric(".");
	//totalizar();
});
function add_itpprot(){
	var htm = <?php echo $campos; ?>;
	can = itpprot_cont.toString();
	con = (itpprot_cont+1).toString();
	htm = htm.replace(/<#i#>/g,can);
	htm = htm.replace(/<#o#>/g,con);
	$("#__INPL__").after(htm);
	$("#cana_"+can).numeric(".");
	$('#cuenta_'+can).focus();
	itpprot_cont=itpprot_cont+1;
}
function del_itpprot(id){
	id = id.toString();
	$('#tr_itpprot_'+id).remove();
	
	totalizar3();
}
function importe(id){
	
	var ind     = id.toString();
	var vcreditos = $("#tipo_"+ind).val();
		
	importe2= Number($("#importe_"+ind).val());
	
	if(vcreditos=='D'){
		
		$("#creditos_"+ind).val(0);	
	
	}else{
	
		$("#creditos_"+ind).val(importe2);
	
	}
	
	totalizar3();
}
function numegreso(){
	
	seriei    = $("#serie").val();
	$.ajax({
		url: "<?=$link?>"+'/'+seriei,
		success: function(msg){
			if(msg){
				$("#numero").val(msg);
			} else {
				alert("No es posible generar un numero");
			}
		}
	});
	
	moneda(seriei);
}
function cfecha(){
	
	fecha    = $("#fecha").val();

	$.ajax({
		url: "<?=$link3?>"+'/'+fecha,
		success: function(msg){
			if(msg){
				alert("Valor de la moneda "+msg+" de FECHA "+fecha);
				$("#cambio").val(msg);
			} else {
				alert("Registrar el valor de la moneda para la FECHA "+fecha);
				$("#cambio").val(0);
			}
		}
	});
	
	//total_manual();

}
function moneda(seriei){
	
	$.ajax({
		url: "<?=$link2?>"+'/'+seriei,
		success: function(msg){
			if(msg){
				$("#moneda").val(msg);
			} else {
				alert("No es posible verificar la moneda");
			}
		}
	});
	
	//total_manual();

}
function totalizar3(){
	
	var tdebitos =0;
	var tcreditos =0;
	var importe=0;
	var creditos=0;
	var ttotals=0;
	var ttotald=0;
	
	var cambio  = $("#cambio").val();
	var monedab = $("#moneda").val();
	
	var arr=$('input[name^="importe_"]');
	jQuery.each(arr, function() {
		nom=this.name;
		pos=this.name.lastIndexOf('_');
		if(pos>0){
			importe = Number(this.value);	
			tdebitos  = (tdebitos+importe);
		}
	});
	
		
	var arr=$('input[name^="creditos_"]');
	jQuery.each(arr, function() {
		nom=this.name;
		pos=this.name.lastIndexOf('_');
		if(pos>0){
			creditos  = Number(this.value);	
			tcreditos = (tcreditos+creditos);
		}
	});
	
	var arr=$('input[id^="dolar_"]');
	jQuery.each(arr, function() {
		nom=this.id;
		pos=this.id.lastIndexOf('_');
		if(pos>0){
			dolar = Number(this.value);	
			ttotald  = (ttotald+dolar);
		}
	});
	
	var arr=$('input[id^="sol_"]');
	jQuery.each(arr, function() {
		nom=this.id;
		pos=this.id.lastIndexOf('_');
		if(pos>0){
			sol = Number(this.value);	
			ttotals  = (ttotals+sol);
		}
	});
    
	var resul=tdebitos-tcreditos;
	
	$("#tdebitos").val(resul);
	$("#tcreditos").val(tcreditos);
	
	ttdebitos = parseFloat($("#tdebitos").val());
	ttcreditos= parseFloat($("#tcreditos").val());
	
	var tot=ttdebitos-ttcreditos;
		
	if(monedab=='01'){
		var sin_provis=tot;
	}else{
		var sin_provis=tot*cambio;
	}
	
	if(monedab=='02'){
		var sin_provid=tot;
	}else{
		var sin_provid=tot/cambio;
	}
    
	var tgenerals=ttotals+sin_provis;
	var tgenerald=ttotald+sin_provid;
	
	$("#monto").val(tgenerald);
	$("#smonto").val(tgenerals);
    $("#smonto_val").text(nformat(tgenerals,2));
    $("#monto_val").text(nformat(tgenerald,2));

}
function marcar(source,cant){
		//alert(cant);
	    totalg=0;
	    cant=cant+1;
		checkboxes=document.getElementsByTagName('input'); //obtenemos todos los controles del tipo Input
        for(i=0;i<checkboxes.length;i++) //recoremos todos los controles
        {
			
            if(checkboxes[i].type == "checkbox") //solo si es un checkbox entramos
            {
                checkboxes[i].checked=source.checked; //si es un checkbox le damos el valor del checkbox que lo llamó (Marcar/Desmarcar Todos)
                
                if(source.checked){
					
					for (var j = 0; j < cant; j++) {
						deuda = $("#deuda_"+j).val();
						pago  = $("#pago_"+j).val(deuda);
						
					}

				}else{
					
					for (var j = 0; j < cant; j++) {
						
						pago  = $("#pago_"+j).val(00);
						
					}
				}
				
				
            }
        }
        
    for (var i = 1; i < cant; i++) {
	 
     var totals = $("#pago_"+i).val();
     totals = parseFloat(totals);
     totalg += totals;
     //alert(totalg);
     
     totalizar_2 (i);
     
	}
       
} 
function totalizar (id,count,check){
	 
 var ttotals=0;
 var ttotald=0;
 var tdebitos=0;
 var tcrebitos=0;
 var totalg=0;
 var cant=0;

  
 var deuda   = $("#deuda_"+id).val();
 var totals  = $("#pago_"+id).val();
 var monto   = $("#monto").val();
 var moneda  = $("#vmoneda_"+id).val();
 var cambio  = $("#cambio").val();
 var monedab = $("#moneda").val();

    
 if(check==true){
	 
	pago=deuda;
	
	if(moneda=='01'){
	    tsol=pago;
    }else{
	    tsol=pago*cambio;
     }
   
	if(moneda=='02'){
		tdolar=pago;
	}else{
		tdolar=pago/cambio;
	}
	
 }else{
    pago=0;
    tdolar=0;
    tsol=0;
 }
 
  var pago= $("#pago_"+id).val(pago); 
  
  tdolar=roundNumber(tdolar,2);
  tsol=roundNumber(tsol,2);
  
  $("#dolar_"+id).val(tdolar); 
  $("#sol_"+id).val(tsol);
 
    var arr=$('input[id^="dolar_"]');
	jQuery.each(arr, function() {
		nom=this.id;
		pos=this.id.lastIndexOf('_');
		if(pos>0){
			dolar = Number(this.value);	
			ttotald  = (ttotald+dolar);
		}
	});
	
	var arr=$('input[id^="sol_"]');
	jQuery.each(arr, function() {
		nom=this.id;
		pos=this.id.lastIndexOf('_');
		if(pos>0){
			sol = Number(this.value);	
			ttotals  = (ttotals+sol);
		}
	});

   	tdebitos = parseFloat($("#tdebitos").val());
	tcreditos= parseFloat($("#tcreditos").val());
   
	var tot=tdebitos-tcreditos;
	
	if(monedab=='01'){
		var sin_provis=tot;
	}else{
		var sin_provis=tot*cambio;
	}
	
	if(monedab=='02'){
		var sin_provid=tot;
	}else{
		var sin_provid=tot/cambio;
	}
   
	var tgenerals=ttotals+sin_provis;
	var tgenerald=ttotald+sin_provid;
	
	$("#monto").val(tgenerald);
	$("#smonto").val(tgenerals);
    $("#smonto_val").text(nformat(tgenerals,2));
    $("#monto_val").text(nformat(tgenerald,2));
 
}
function ttotal(){
	
	var ttotals=0;
	var ttotald=0;
	var tdebitos=0;
	var tcrebitos=0;

	
	var monto   = $("#monto").val();
	var cambio  = $("#cambio").val();
	var monedab = $("#moneda").val();
	
	var arr=$('input[id^="dolar_"]');
	jQuery.each(arr, function() {
		nom=this.id;
		pos=this.id.lastIndexOf('_');
		if(pos>0){
			dolar = Number(this.value);	
			ttotald  = (ttotald+dolar);
		}
	});
	
	var arr=$('input[id^="sol_"]');
	jQuery.each(arr, function() {
		nom=this.id;
		pos=this.id.lastIndexOf('_');
		if(pos>0){
			sol = Number(this.value);	
			ttotals  = (ttotals+sol);
		}
	});

   	tdebitos = parseFloat($("#tdebitos").val());
	tcreditos= parseFloat($("#tcreditos").val());
   
	var tot=tdebitos-tcreditos;
	
	if(monedab=='01'){
		var sin_provis=tot;
	}else{
		var sin_provis=tot*cambio;
	}
	
	if(monedab=='02'){
		var sin_provid=tot;
	}else{
		var sin_provid=tot/cambio;
	}
   
	var tgenerals=ttotals+sin_provis;
	var tgenerald=ttotald+sin_provid;
	
	$("#monto").val(tgenerald);
	$("#smonto").val(tgenerals);
    $("#smonto_val").text(nformat(tgenerals,2));
    $("#monto_val").text(nformat(tgenerald,2));


}
function totalizar_2 (id){
	
 var totals  = $("#pago_"+id).val();
 var moneda  = $("#vmoneda_"+id).val();
 var cambio  = $("#cambio").val();

 pago=totals;
    
 if(pago>0){
	 	
	if(moneda=='01'){
	    tsol=pago;
    }else{
	    tsol=pago*cambio;
     }
   
	if(moneda=='02'){
		tdolar=pago;
	}else{
		tdolar=pago/cambio;
	}
	
 }else{
 
    tdolar=0;
    tsol=0;
 }
 
  tdolar=roundNumber(tdolar,2);
  tsol=roundNumber(tsol,2);
  
  $("#dolar_"+id).val(tdolar); 
  $("#sol_"+id).val(tsol);
  
  ttotal();
 
}
</script>
<?php } ?>
<table align='center' width="90%" style='background: #EEEEEE'>
	<tr>
		<?php if ($form->_status=='show') { ?>
		<td>
		<a href="#" onClick="window.open('<?php echo base_url() ?>formatos/verhtml/PAGO/<?php echo $form->tipo->value ?>/<?php echo $form->serie->value ?>/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/html_icon.gif'></a>
		<a href="#" onClick="window.open('<?php echo base_url() ?>formatos/ver/PAGO/<?php echo $form->tipo->value ?>/<?php echo $form->serie->value ?>/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/pdf_logo.gif'></a> Comprobante 
		</td>
	<?php } ?>
	  <td colspan="3" align="right"><?php echo $container_tr?><?php echo $container_br?></td>
  </tr>
</table>
<table align='center' width="95%">
	<tr>
		<td>
         <table align='center' width="100%">
	<tr>
		<td>
		<table width='100%'><tr><td>
		<fieldset style='border: 2px outset #9AC8DA;background: #FFFFFF;'>
		<legend class="titulofieldset" style='color: #2E4B77;'>Informaci&ograve;n del Pago Realizado</legend>
			<table style="margin: 0; width: 100%;">
			<tr>
				<td class="littletableheader"><?php echo $form->serie->label;    ?></td>
				<td colspan="2" class="littletablerow"><strong><?php echo $form->serie->output;   ?>-<?php echo $form->numero->output;   ?></strong></td>
			</tr>
			<tr>
				<td class="littletableheader"><?php echo $form->fecha->label;    ?></td>
				<td colspan="2" class="littletablerow">   <?php echo $form->fecha->output;   ?></td>
			</tr>
			<tr>
				<td class="littletableheader"><?php echo $form->ccosto->label;    ?></td>
				<td colspan="2" class="littletablerow">   <?php echo $form->ccosto->output;   ?></td>
			</tr>
			<tr>
				<td class="littletableheader"><?php echo $form->cuenta2->label;    ?></td>
				<td colspan="2" class="littletablerow">   <?php echo $form->cuenta2->output;   ?></td>
			</tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->formap->label     ?></td>
			  <td colspan="2" class="littletablerow"><?php echo $form->formap->output    ?></td>
			</tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->referen->label     ?></td>
			  <td colspan="2" class="littletablerow"><?php echo $form->referen->output    ?></td>
			</tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->tipo2->label     ?></td>
			  <td colspan="2" class="littletablerow"><?php echo $form->tipo2->output    ?></td>
			  </tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->moneda->label     ?></td>
			  <td colspan="2" class="littletablerow"><?php echo $form->moneda->output    ?></td>
			</tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->cambio->label     ?></td>
			  <td colspan="2" class="littletablerow"><?php echo $form->cambio->output    ?></td>
			</tr>  
			</table>
			</fieldset>
		</td><td width="50%">
			<fieldset style='border: 2px outset #9AC8DA;background: #FFFFFF;'>
			<legend  class="titulofieldset" style='color: #2E4B77;'>Identificaci&oacute;n del Proveedor </legend>
			<table  style="margin: 0; width: 100%;">
			<tr>
				<td width="33%" class="littletableheader"><?php echo $form->proveed->label;  ?></td>
				<td class="littletablerow"><?php echo $form->proveed->output; ?></td>
				</tr>
			<tr>
				<td class="littletableheader"><?php echo $form->nombre->label;  ?></td>
				<td class="littletablerow"><?php echo $form->nombre->output;  ?></span></td>
			</tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->rif->label; ?></td>
			  <td class="littletablerow"><?php echo $form->rif->output;   ?></td>
			</tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->cajachica->label; ?></td>
			  <td class="littletablerow"><?php echo $form->cajachica->output;   ?></td>
			</tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->detraccion->label; ?></td>
			  <td class="littletablerow"><?php echo $form->detraccion->output;   ?></td>
			</tr>
			</table>
			</fieldset>
		</td><tr></table>
		<br>		</td>
	</tr>
	<tr>
		<td>Otros Documentos por Pagar</td>
	</tr>
	<tr>
		<td>
		<div style='overflow:auto;border: 1px solid #9AC8DA;background: #FAFAFA;height:120px'>
		<table width='85%' border='0' align="center">
			<tr id='__INPL__' class="littletablerow">
				<td bgcolor='#6DA7D3'>Documento</td>
				<td bgcolor='#6DA7D3'>Cuenta </td>
				<td bgcolor='#6DA7D3'>Descripci&oacute;n</td>
				<td bgcolor='#6DA7D3'>RUC</td>
				<td bgcolor='#6DA7D3'>Tipo</td>
				<td bgcolor='#6DA7D3' align="center">Monto</td>
				<?php if ($form->_status!='show') { ?>
				<td bgcolor='#6DA7D3' align="center">Creditos</td>
				<?}?>
				<?php if($form->_status!='show') {?>
					<td class="littletableheader">&nbsp;</td>
				<?php } ?>
			</tr>

			<?php for($i=0;$i<$form->max_rel_count['itpprot'];$i++) {
				$it_docu    = "docu_$i";
				$it_cuenta  = "cuenta_$i";
				$it_desca   = "desca_$i";
				$it_ruc     = "ruc_$i";
				$it_tipo    = "tipo_$i";
				$it_importe = "importe_$i";
				$it_creditos= "creditos_$i";
			

			?>

			<tr id='tr_itpprot_<?php echo $i; ?>'>
			    <td class="littletablerow" align="left"><?php echo $form->$it_docu->output; ?></td>
				<td class="littletablerow" align="left"><?php echo $form->$it_cuenta->output; ?></td>
				<td class="littletablerow" align="left"><?php echo $form->$it_desca->output;  ?></td>
				<td class="littletablerow" align="left"><?php echo $form->$it_ruc->output;  ?></td>
				<td class="littletablerow" align="center"><?php echo $form->$it_tipo->output;  ?></td>
				<td align="center" class="littletablerow"><?php echo $form->$it_importe->output;   ?></td>
				<?php if ($form->_status!='show') { ?>
				<td class="littletablerow" align="left"><?php echo $form->$it_creditos->output;?></td>
				<?php } ?>
				<?php if($form->_status!='show') {?>
				<td class="littletablerow">
					<a href='#' onclick='del_itpprot(<?=$i ?>);return false;'><?php echo img("images/delete.jpg"); ?></a>				</td>
				<?php } ?>
			</tr>
			<?php } ?>

			<tr id='__UTPL__'>
				<td id='cueca'></td>
			</tr>
		</table>
		</div>
		<?php echo $container_bl ?>
		</td>
	</tr>
	<tr>
		<td>
		<div style='overflow:auto;border: 1px solid #9AC8DA;background: #FAFAFA;height:200px'>	
		  <table width='100%' border='0' align="center">
            <tr class="littletablerow" align="center">
				<td colspan='12' align='left'><input type="checkbox" onclick="marcar(this,<?=$cantmd?>);" /> Marcar/Desmarcar todas las Facturas Pendientes</td>
            </tr>
            <tr class="littletablerow" align="center">
              <td colspan="2" bgcolor='#527D9E'>Numero FC /Proveedor (<?=$cantmd?>)</td>
              <td bgcolor='#527D9E'>Moneda</td>
              <td bgcolor='#527D9E'>Fecha</td>
              <td bgcolor='#527D9E'>Vence</td>
              <td bgcolor='#527D9E'>Sub-Total</td>
			  <td bgcolor='#527D9E'>Detracci&ograve;n</td>
              <td bgcolor='#527D9E'>IGV </td>
              <td bgcolor='#527D9E'>Total</td>
              <td bgcolor='#527D9E'>Pagos</td>
              <td bgcolor='#527D9E'>Deuda</td>
              <td bgcolor='#89E18D'>Monto a Pagar </td>
              <td bgcolor='#3AE9FF'>Conversi&oacute;n</td>
            </tr>
		    <? $tmonto=0; $totalg=0; $tabonos=0; $tdeudas=0; $i=0; $count=count($result); foreach ($result AS $items){$i++;?>
            <? $tmonto+=$items->totalg ?>
            <? $tabonos+=$items->abonos ?>
            <? $tdeudas+=$items->monto-$items->abonos ?>
            <? if($form->_status=='show'){ $pago=$items->ultiabonado; ?>
            <? }else{ $pago='0';}?>
            <? $hoy= date('Y-m-d'); ?>
            <? $vencio= $items->vence; ?>
            <? IF($vencio < $hoy){ $vence="<font color='red'>".dbdate_to_human($items->vence)."</font>"; ?>
            <? }else{ $vence=dbdate_to_human($items->vence);  }?>
            <tr>
              <td class="littletablerow" align="center">
				  <input type="checkbox"   id="chek_<?= $i ?>"  onclick="totalizar(<?= $i ?>,<?= $count ?>,this.checked)"  /></td>
              <td class="littletablerow" align="center">
				  <input type="text"   name="tipodd[]"  size=1 value="<?=$items->tipo_doc?>" readonly="false" />
				  <input type="text"   name="serief[]"  size=3 value="<?=$items->seriep?>" readonly="false" />-
				  <input type="text"   name="ffact[]"  value="<?=$items->factura?>" size="11" readonly="false" />/
				  <input type="text"   name="proveedor[]" value="<?=$items->proveed?>" size="5" readonly="false" />
				  <input type="hidden" name="factura[]"   value="<?=$items->numero ?>"/>
                  <input type="hidden" name="cod_prv[]"   value="<?=$items->cod_prv ?>"/>
		          <input type="hidden" name="numerof[]"   value="<?=$items->factura ?>"/>
		          <input type="hidden" name="cant"   value="<?=$cantmd ?>"/>
              </td>
              <td align='center' class="littletablerow"><input id="vmoneda_<?= $i ?>"  name="vmoneda_<?= $i ?>" type="text"  size=2 value="<?=$items->moneda?>" readonly="false" /></td>
              <td class="littletablerow" align="center"><?=dbdate_to_human($items->fecha) ?></td>
              <td align="center" class="littletablerow" ><?= $vence ?></td>
              <td class="littletablerow" align='right'><?= nformat($items->subtotal) ?></td>
              <td align='right' class="littletablerow"><?= $items->montodetra ?></td>
			  <td align='right' class="littletablerow"><?= nformat($items->impuesto) ?></td>
			  <td align='right' class="littletablerow"><?= nformat($items->totalg) ?></td>
              <td class="littletablerow" align='right'><?= nformat($items->abonos) ?></td>
              <td class="littletablerow" align='right'><input id="deuda_<?= $i ?>"  name="deuda_<?= $i ?>" type="text" size="7" value="<?= $items->monto-$items->abonos ?>" readonly="false" align="right" class='input' /></td>
              <td class="littletablerow" align='center' bgcolor='#89E18D'><input id="pago_<?= $i ?>"   name="pago[]"  type="text" size="7" value="<?= $pago ?>" onkeyup="totalizar_2(<?= $i ?>)" align="right" class='input' /></td>
			  <td class="littletablerow" align='right'>S/.<input id="sol_<?= $i ?>"   name="cmontos[]"  type="text" size="8"  align="right"  class='input' value='0' onkeyup="ttotal()" />US$<input id="dolar_<?= $i ?>"   name="cmontod[]"  type="text" size="8"  align="right"  class='input' value='0' onkeyup="ttotal()"/></td>
			</tr>
            <? }?>
          </table>
		</div>
		</td>
	</tr>
	<tr>
		<td>
		<fieldset style='border: 2px outset #9AC8DA;background: #EFEFEF;'>
		<legend  class="titulofieldset" style='color: #2E4B77;' align="right">-- Totales --</legend>
		<table width='100%'>
				<tr>
				<td  width="15%" class="littletableheader"><?php echo $form->condi1->label;    ?></td>
				<td  width="25%" class="littletablerow"   ><?php echo $form->condi1->output;   ?></td>
				<td  width="40%" align='right' class="littletablerow"><strong><?php echo $form->monto->label;  ?></strong></td>
				<td  width="5%" align='right' class="littletablerow">S/.</td>
				<td  width="10%"><b id='smonto_val'><input id="smonto"  class="input"  name="smonto"  type="text" size="10"  value="0" readonly="false" /></b></td>
				<td  width="5%" align='right' class="littletablerow">US$</td>
				<td  width="10%"><b id='monto_val'><input id="monto"  class="input"  name="monto"  type="text" size="10"  value="0" readonly="false" /></b></td>
				</tr>
			  <input type="hidden"    id="tcreditos" value="0" name="tcreditos"   size="10" readonly="false" class="input" />
			  <input type="hidden"    id="tdebitos"  value="0" name="tdebitos"   size="10" readonly="false" class="input" />
			  <input type="hidden"    id="monto"   value="0" name="monto"   size="10" readonly="false" class="input" />
			  <input type="hidden"    id="smonto"  value="0" name="smonto"   size="10" readonly="false" class="input" />
          </table>
		</fieldset>	
		</td>
	</tr>
</table>
<?php echo $form_end?>
<?php echo $container_br ?>
	  <td>
	<tr>
<table>
<?php endif; ?>
